<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
        <center>
            <form action="{url:/exam/register}" method="post">
                用户名：<input type="text" name="name" id="name"><br>
                密码：<input type="password" name="pwd" id="pwd"><br>
                邮箱：<input type="email" name="email" id="email"><br>
                <input type="button" id="btn" value="注册">
            </form>
        </center>
</body>
</html>
<script src="../jquery-3.3.1.min.js"></script>
<script>
    $("#btn").click(function(){
       var name=$("#name").val();
       var pwd=$("#pwd").val();
       var email=$("#email").val();
       if(name==""||pwd==""||email=="")
       {
           alert("输入内容不能为空");
           return false;
       }

       var filter=/^\w+@\w+(\.)(com|cn|net|org)$/i;
       if(!filter.test(email))
       {
           alert("您输入的邮箱格式不正确");
           return false;
       }
        $("form").submit();
    });
</script>
























